package com.ease.map.task.query {
   import com.ease.map.Map;
   import com.ease.map.RemoteCaller;
   import com.ease.map.layer.LayerData;

   import mx.collections.ArrayCollection;
   import mx.rpc.AsyncResponder;
   import mx.rpc.AsyncToken;
   import mx.rpc.events.ResultEvent;
   import com.ease.map.task.query.Query;

   /**
    * 通过objectid查询矢量设施
    */
   public class LayerObjectIdsQuery extends Query {
      //图层id
      private var _layerId:Number;
      //设施ids
      private var _objectIds:ArrayCollection;

      public function LayerObjectIdsQuery(layerId:Number,objectIds:ArrayCollection) {
         this._layerId = layerId;
         this._objectIds = objectIds;
         super("getLayerDataByLayerIdObjectIds");
      }

      override public function execute():void {
         if (null == onResult)
            return;
         // var remoteCaller:RemoteCaller = new RemoteCaller(map.serverUrl, "spatialDataManagementService", null);
         var remoteCaller:RemoteCaller = new RemoteCaller("spatialDataManagementService");
         var token:AsyncToken = remoteCaller.remoteObject.getOperation(operationName).send(layerId, objectIds);
         token.addResponder(new AsyncResponder(onQueryResult, onQueryFault));
      }

      /**根据图层id和objectid数组 获取 矢量设施数据*/
      private function onQueryResult(event:ResultEvent, token:Object = null):void {
         var layerData:LayerData = event.result as LayerData;

         onResult(layerData, token);
      }

      public function get layerId():Number {
         return _layerId;
      }

      public function set layerId(value:Number):void {
         _layerId = value;
      }

      public function get objectIds():ArrayCollection {
         return _objectIds;
      }

      public function set objectIds(value:ArrayCollection):void {
         _objectIds = value;
      }


   }
}